/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.myapp.c0910g.entity;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author BachLe
 */
@Stateless
public class UserRoleFacade extends AbstractFacade<UserRole> {
    @PersistenceContext(unitName = "RadioCabsProject-ejbPU")
    private EntityManager em;

    protected EntityManager getEntityManager() {
        return em;
    }

    public UserRoleFacade() {
        super(UserRole.class);
    }

    public UserRole getUserRoleByName(String name){
        String eql = "SELECT u FROM UserRole u WHERE u.roleName = :roleName ";
        return (UserRole)em.createQuery(eql).setParameter("roleName", name).getSingleResult();
    }
}
